package com.zto.sch.base.thread;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-01-07 16:57
 **/
public class SingletonDemo {
    private volatile SingletonDemo singletonDemo;

    private SingletonDemo() {
    }

    public SingletonDemo getInstance() {
        if (null == singletonDemo) {
            synchronized (SingletonDemo.class) {
                if (null == singletonDemo) {
                    singletonDemo = new SingletonDemo();
                }
            }
        }
        return singletonDemo;
    }
}
